home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 3017 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  832 b 

  1. Path: sun001.spd.dsccc.com!news
  2. From: David Hacker, PB1-2426 <dhacker@aplo285.spd.dsccc.com>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: why get 9 strings only?
  5. Date: 25 Jan 1996 15:03:12 GMT
  6. Organization: DSC Communications Corporation, Plano, Texas USA
  7. Message-ID: <4e863g$t74@sun001.spd.dsccc.com>
  8. References: <4e51th$4bi@news.nevada.edu>
  9. NNTP-Posting-Host: aplo285.spd.dsccc.com
  10. X-Newsreader: NCSA Mosaic
  11.  
  12.  
  13. The scanf does not pick up the newline.  So the first time through the for
  14. loop, it thinks there's a string already out there - that's why it appears
  15. that the for loop doesn't do anything the first time through.
  16.  
  17. I'm not sure how to modify the scanf to get it to pick up the newline.
  18.  
  19. However, you can replace the scanf call with a call to gets followed by
  20. a call to sscanf using the string returned by gets as input to sscanf.
  21.